from xlrd import open_workbook
import openpyxl

# read = open_workbook("111.xls").sheet_by_name("111")
# col = read.ncols
# row = read.nrows
# for i in range(row):
#     for n in range(col):
#         print(read.cell_value(i, n), end="\t")

# 方法2
read = openpyxl.load_workbook("ss.xlsx")["222"].rows
title = [i.value for i in next(read)]
result = []
for item in read:
    data = [i.value for i in item]
    v = dict(zip(title, data))
    result.append(v)
print(result)

print("\n--------------------------")
# 方法2精简版
# rows2=openpyxl.load_workbook("ss.xlsx")["222"].rows
# result2=[dict(zip([i.value for i in rows[0]],[i.value for i in item])) for item in rows2]
# print(result2)
# # lambda精简版
# rows3=list(openpyxl.load_workbook("ss.xlsx")["222"].rows)
# result3=[dict(zip(map(lambda i:i.value,rows3[0]),map(lambda i:i.value,item))) for item in rows3[1:]]
# print(result3)
